<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: Form
  
    &mdash; Documentation by YARD 0.7.3
  
</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '';
  if (relpath != '') relpath += '/';
</script>

  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="js/app.js"></script>


  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="_index.html">Index (F)</a> &raquo; 
    
    
    <span class="title">Form</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a id="class_list_link" href="#">Class List</a>
  
    <a id="method_list_link" href="#">Method List</a>
  
    <a id="file_list_link" href="#">File List</a>
  
</div>
      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><h1>Class: Form
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">ActiveRecord::Base</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">ActiveRecord::Base</li>
          
            <li class="next">Form</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">app/models/form.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>
ELMO - Secure, robust, and versatile data collection. Copyright 2011 The
Carter Center
</p>
<p>
ELMO is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
</p>
<p>
ELMO is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
</p>
<p>
You should have received a copy of the GNU General Public License along
with ELMO. If not, see &lt;http://www.gnu.org/licenses/&gt;.
</p>


  </div>
</div>
<div class="tags">
  

</div>

  


  

  
    <h2>
      Class Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#default_eager-class_method" title="default_eager (class method)">+ (Object) <strong>default_eager</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#find_eager-class_method" title="find_eager (class method)">+ (Object) <strong>find_eager</strong>(id) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#max_version-class_method" title="max_version (class method)">+ (Object) <strong>max_version</strong>(base_name) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>
finds the highest &#8216;version&#8217; number of all forms with the given
base name returns nil if no forms found.
</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#per_page-class_method" title="per_page (class method)">+ (Object) <strong>per_page</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#select_options-class_method" title="select_options (class method)">+ (Object) <strong>select_options</strong>(options = {}) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#sorted-class_method" title="sorted (class method)">+ (Object) <strong>sorted</strong>(params) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
    </ul>
  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#add_download-instance_method" title="#add_download (instance method)">- (Object) <strong>add_download</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#destroy_questionings-instance_method" title="#destroy_questionings (instance method)">- (Object) <strong>destroy_questionings</strong>(qings) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#duplicate-instance_method" title="#duplicate (instance method)">- (Object) <strong>duplicate</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>
makes a copy of the form, with a new name and a new set of questionings.
</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#full_name-instance_method" title="#full_name (instance method)">- (Object) <strong>full_name</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#max_rank-instance_method" title="#max_rank (instance method)">- (Object) <strong>max_rank</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#option_sets-instance_method" title="#option_sets (instance method)">- (Object) <strong>option_sets</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#temp_response_id-instance_method" title="#temp_response_id (instance method)">- (Object) <strong>temp_response_id</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#toggle_published-instance_method" title="#toggle_published (instance method)">- (Object) <strong>toggle_published</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#update_ranks-instance_method" title="#update_ranks (instance method)">- (Object) <strong>update_ranks</strong>(new_ranks) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#version-instance_method" title="#version (instance method)">- (Object) <strong>version</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#visible_questionings-instance_method" title="#visible_questionings (instance method)">- (Object) <strong>visible_questionings</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
    </ul>
  


  

  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="default_eager-class_method">
  
    + (<tt>Object</tt>) <strong>default_eager</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


42
43
44</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 42</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='default_eager identifier id'>default_eager</span>
  <span class='lbrack token'>[</span><span class='symbol val'>:type</span><span class='rbrack token'>]</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="find_eager-class_method">
  
    + (<tt>Object</tt>) <strong>find_eager</strong>(id) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


46
47
48
49
50</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 46</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='find_eager identifier id'>find_eager</span><span class='lparen token'>(</span><span class='id identifier id'>id</span><span class='rparen token'>)</span>
  <span class='find identifier id'>find</span><span class='lparen token'>(</span><span class='id identifier id'>id</span><span class='comma token'>,</span> <span class='symbol val'>:include</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrack token'>[</span><span class='symbol val'>:type</span><span class='comma token'>,</span> <span class='lbrace token'>{</span><span class='symbol val'>:questionings</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrace token'>{</span><span class='symbol val'>:question</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> 
      <span class='lbrack token'>[</span><span class='symbol val'>:type</span><span class='comma token'>,</span> <span class='symbol val'>:translations</span><span class='comma token'>,</span> <span class='lbrace token'>{</span><span class='symbol val'>:option_set</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrace token'>{</span><span class='symbol val'>:option_settings</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrace token'>{</span><span class='symbol val'>:option</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:translations</span><span class='rbrace token'>}</span><span class='rbrace token'>}</span><span class='rbrace token'>}</span><span class='rbrack token'>]</span>
  <span class='rbrace token'>}</span><span class='rbrace token'>}</span><span class='rbrack token'>]</span><span class='rparen token'>)</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="max_version-class_method">
  
    + (<tt>Object</tt>) <strong>max_version</strong>(base_name) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>
finds the highest &#8216;version&#8217; number of all forms with the given
base name returns nil if no forms found
</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


60
61
62
63</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 60</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='max_version identifier id'>max_version</span><span class='lparen token'>(</span><span class='base_name identifier id'>base_name</span><span class='rparen token'>)</span>
  <span class='mv identifier id'>mv</span> <span class='assign token'>=</span> <span class='all identifier id'>all</span><span class='dot token'>.</span><span class='collect identifier id'>collect</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='f identifier id'>f</span><span class='bitor op'>|</span> <span class='m identifier id'>m</span> <span class='assign token'>=</span> <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='name identifier id'>name</span><span class='dot token'>.</span><span class='match identifier id'>match</span><span class='lparen token'>(</span><span class='dregexp node'>/^#{base_name}( v(\d+))?$/</span><span class='rparen token'>)</span><span class='semicolon token'>;</span> <span class='m identifier id'>m</span> <span class='integer val'>? </span><span class='lparen token'>(</span><span class='m identifier id'>m</span><span class='lbrack token'>[</span><span class='integer val'>2</span><span class='rbrack token'>]</span> <span class='question op'>?</span> <span class='m identifier id'>m</span><span class='lbrack token'>[</span><span class='integer val'>2</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='to_i identifier id'>to_i</span> <span class='colon op'>:</span> <span class='integer val'>1</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='integer val'>0</span><span class='rbrace token'>}</span><span class='dot token'>.</span><span class='max identifier id'>max</span>
  <span class='mv identifier id'>mv</span> <span class='eq op'>==</span> <span class='integer val'>0</span> <span class='question op'>?</span> <span class='nil nil kw'>nil</span> <span class='colon op'>:</span> <span class='mv identifier id'>mv</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="per_page-class_method">
  
    + (<tt>Object</tt>) <strong>per_page</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


33
34
35</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 33</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='per_page identifier id'>per_page</span>
  <span class='integer val'>1000000</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="select_options-class_method">
  
    + (<tt>Object</tt>) <strong>select_options</strong>(options = {}) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


52
53
54
55
56</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 52</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='select_options identifier id'>select_options</span><span class='lparen token'>(</span><span class='options identifier id'>options</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
  <span class='params identifier id'>params</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='symbol val'>:include</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:type</span><span class='comma token'>,</span> <span class='symbol val'>:order</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;form_types.name, forms.name&quot;</span><span class='rbrace token'>}</span>
  <span class='params identifier id'>params</span><span class='lbrack token'>[</span><span class='symbol val'>:conditions</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='symbol val'>:published</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:published</span><span class='rbrack token'>]</span><span class='rbrace token'>}</span> <span class='if if_mod kw'>if</span> <span class='notop op'>!</span><span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:published</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='nil? fid id'>nil?</span>
  <span class='all identifier id'>all</span><span class='lparen token'>(</span><span class='params identifier id'>params</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='collect identifier id'>collect</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='f identifier id'>f</span><span class='bitor op'>|</span> <span class='lbrack token'>[</span><span class='f identifier id'>f</span><span class='dot token'>.</span><span class='full_name identifier id'>full_name</span><span class='comma token'>,</span> <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='id identifier id'>id</span><span class='rbrack token'>]</span><span class='rbrace token'>}</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="sorted-class_method">
  
    + (<tt>Object</tt>) <strong>sorted</strong>(params) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


37
38
39
40</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 37</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='sorted identifier id'>sorted</span><span class='lparen token'>(</span><span class='params identifier id'>params</span><span class='rparen token'>)</span>
  <span class='params identifier id'>params</span><span class='dot token'>.</span><span class='merge! fid id'>merge!</span><span class='lparen token'>(</span><span class='symbol val'>:order</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;form_types.name, forms.name&quot;</span><span class='rparen token'>)</span>
  <span class='params identifier id'>params</span><span class='lbrack token'>[</span><span class='symbol val'>:page</span><span class='rbrack token'>]</span> <span class='question op'>?</span> <span class='paginate identifier id'>paginate</span><span class='lparen token'>(</span><span class='symbol val'>:all</span><span class='comma token'>,</span> <span class='params identifier id'>params</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='find identifier id'>find</span><span class='lparen token'>(</span><span class='symbol val'>:all</span><span class='comma token'>,</span> <span class='params identifier id'>params</span><span class='rparen token'>)</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="add_download-instance_method">
  
    - (<tt>Object</tt>) <strong>add_download</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


112
113
114
115</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 112</span>

<span class='def def kw'>def</span> <span class='add_download identifier id'>add_download</span>
  <span class='self self kw'>self</span><span class='dot token'>.</span><span class='downloads identifier id'>downloads</span> <span class='opasgn op'>+=</span> <span class='integer val'>1</span>
  <span class='save identifier id'>save</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="destroy_questionings-instance_method">
  
    - (<tt>Object</tt>) <strong>destroy_questionings</strong>(qings) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


96
97
98
99
100
101
102
103
104</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 96</span>

<span class='def def kw'>def</span> <span class='destroy_questionings identifier id'>destroy_questionings</span><span class='lparen token'>(</span><span class='qings identifier id'>qings</span><span class='rparen token'>)</span>
  <span class='transaction identifier id'>transaction</span> <span class='do do kw'>do</span>
    <span class='qings identifier id'>qings</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='qing identifier id'>qing</span><span class='bitor op'>|</span>
      <span class='questionings identifier id'>questionings</span><span class='dot token'>.</span><span class='delete identifier id'>delete</span><span class='lparen token'>(</span><span class='qing identifier id'>qing</span><span class='rparen token'>)</span>
      <span class='qing identifier id'>qing</span><span class='dot token'>.</span><span class='destroy identifier id'>destroy</span>
    <span class='end end kw'>end</span>
    <span class='save identifier id'>save</span>
  <span class='end end kw'>end</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="duplicate-instance_method">
  
    - (<tt>Object</tt>) <strong>duplicate</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>
makes a copy of the form, with a new name and a new set of questionings
</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


118
119
120
121
122
123
124
125
126
127
128</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 118</span>

<span class='def def kw'>def</span> <span class='duplicate identifier id'>duplicate</span>
  <span class='comment val'># get the base name</span>
  <span class='base identifier id'>base</span> <span class='assign token'>=</span> <span class='name identifier id'>name</span><span class='dot token'>.</span><span class='match identifier id'>match</span><span class='lparen token'>(</span><span class='regexp val'>/^(.+?)( v(\d+))?$/</span><span class='rparen token'>)</span><span class='lbrack token'>[</span><span class='integer val'>1</span><span class='rbrack token'>]</span>
  <span class='version identifier id'>version</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='self self kw'>self</span><span class='dot token'>.</span><span class='class identifier id'>class</span><span class='dot token'>.</span><span class='max_version identifier id'>max_version</span><span class='lparen token'>(</span><span class='base identifier id'>base</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='integer val'>1</span><span class='rparen token'>)</span> <span class='plus op'>+</span> <span class='integer val'>1</span>
  <span class='comment val'># create the new form and set the basic attribs</span>
  <span class='cloned identifier id'>cloned</span> <span class='assign token'>=</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='class identifier id'>class</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='symbol val'>:name</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='dstring node'>&quot;#{base} v#{version}&quot;</span><span class='comma token'>,</span> <span class='symbol val'>:published</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='false false kw'>false</span><span class='comma token'>,</span> <span class='symbol val'>:form_type_id</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='form_type_id identifier id'>form_type_id</span><span class='rparen token'>)</span>
  <span class='comment val'># clone all the questionings</span>
  <span class='cloned identifier id'>cloned</span><span class='dot token'>.</span><span class='questionings identifier id'>questionings</span> <span class='assign token'>=</span> <span class='Questioning constant id'>Questioning</span><span class='dot token'>.</span><span class='duplicate identifier id'>duplicate</span><span class='lparen token'>(</span><span class='questionings identifier id'>questionings</span><span class='rparen token'>)</span>
  <span class='comment val'># done!</span>
  <span class='cloned identifier id'>cloned</span><span class='dot token'>.</span><span class='save identifier id'>save</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="full_name-instance_method">
  
    - (<tt>Object</tt>) <strong>full_name</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


73
74
75</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 73</span>

<span class='def def kw'>def</span> <span class='full_name identifier id'>full_name</span>
  <span class='dstring node'>&quot;#{type.name}: #{name}&quot;</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="max_rank-instance_method">
  
    - (<tt>Object</tt>) <strong>max_rank</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


85
86
87</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 85</span>

<span class='def def kw'>def</span> <span class='max_rank identifier id'>max_rank</span>
  <span class='questionings identifier id'>questionings</span><span class='dot token'>.</span><span class='map identifier id'>map</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='qing identifier id'>qing</span><span class='bitor op'>|</span> <span class='qing identifier id'>qing</span><span class='dot token'>.</span><span class='rank identifier id'>rank</span><span class='rbrace token'>}</span><span class='dot token'>.</span><span class='max identifier id'>max</span> <span class='orop op'>||</span> <span class='integer val'>0</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="option_sets-instance_method">
  
    - (<tt>Object</tt>) <strong>option_sets</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


77
78
79</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 77</span>

<span class='def def kw'>def</span> <span class='option_sets identifier id'>option_sets</span>
  <span class='questions identifier id'>questions</span><span class='dot token'>.</span><span class='collect identifier id'>collect</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='q identifier id'>q</span><span class='bitor op'>|</span> <span class='q identifier id'>q</span><span class='dot token'>.</span><span class='option_set identifier id'>option_set</span><span class='rbrace token'>}</span><span class='dot token'>.</span><span class='compact identifier id'>compact</span><span class='dot token'>.</span><span class='uniq identifier id'>uniq</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="temp_response_id-instance_method">
  
    - (<tt>Object</tt>) <strong>temp_response_id</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


65
66
67</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 65</span>

<span class='def def kw'>def</span> <span class='temp_response_id identifier id'>temp_response_id</span>
  <span class='dstring node'>&quot;#{name}_#{ActiveSupport::SecureRandom.random_number(899999999) + 100000000}&quot;</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="toggle_published-instance_method">
  
    - (<tt>Object</tt>) <strong>toggle_published</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


106
107
108
109
110</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 106</span>

<span class='def def kw'>def</span> <span class='toggle_published identifier id'>toggle_published</span>
  <span class='self self kw'>self</span><span class='dot token'>.</span><span class='published identifier id'>published</span> <span class='assign token'>=</span> <span class='notop op'>!</span><span class='self self kw'>self</span><span class='dot token'>.</span><span class='published? fid id'>published?</span>
  <span class='self self kw'>self</span><span class='dot token'>.</span><span class='downloads identifier id'>downloads</span> <span class='assign token'>=</span> <span class='integer val'>0</span>
  <span class='save identifier id'>save</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="update_ranks-instance_method">
  
    - (<tt>Object</tt>) <strong>update_ranks</strong>(new_ranks) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


89
90
91
92
93
94</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 89</span>

<span class='def def kw'>def</span> <span class='update_ranks identifier id'>update_ranks</span><span class='lparen token'>(</span><span class='new_ranks identifier id'>new_ranks</span><span class='rparen token'>)</span>
  <span class='transaction identifier id'>transaction</span> <span class='do do kw'>do</span> 
    <span class='questionings identifier id'>questionings</span><span class='dot token'>.</span><span class='each identifier id'>each</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='qing identifier id'>qing</span><span class='bitor op'>|</span> <span class='qing identifier id'>qing</span><span class='dot token'>.</span><span class='update_rank identifier id'>update_rank</span><span class='lparen token'>(</span><span class='new_ranks identifier id'>new_ranks</span><span class='lbrack token'>[</span><span class='qing identifier id'>qing</span><span class='dot token'>.</span><span class='id identifier id'>id</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='to_i identifier id'>to_i</span><span class='rparen token'>)</span> <span class='if if_mod kw'>if</span> <span class='new_ranks identifier id'>new_ranks</span><span class='lbrack token'>[</span><span class='qing identifier id'>qing</span><span class='dot token'>.</span><span class='id identifier id'>id</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='rbrack token'>]</span><span class='rbrace token'>}</span>
    <span class='questionings identifier id'>questionings</span><span class='dot token'>.</span><span class='each identifier id'>each</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='qing identifier id'>qing</span><span class='bitor op'>|</span> <span class='qing identifier id'>qing</span><span class='dot token'>.</span><span class='verify_condition_ordering identifier id'>verify_condition_ordering</span><span class='rbrace token'>}</span>
  <span class='end end kw'>end</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="version-instance_method">
  
    - (<tt>Object</tt>) <strong>version</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


69
70
71</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 69</span>

<span class='def def kw'>def</span> <span class='version identifier id'>version</span>
  <span class='string val'>&quot;1.0&quot;</span> <span class='comment val'># this isn't implemented yet</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="visible_questionings-instance_method">
  
    - (<tt>Object</tt>) <strong>visible_questionings</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


81
82
83</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/form.rb', line 81</span>

<span class='def def kw'>def</span> <span class='visible_questionings identifier id'>visible_questionings</span>
  <span class='questionings identifier id'>questionings</span><span class='dot token'>.</span><span class='reject identifier id'>reject</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='q identifier id'>q</span><span class='bitor op'>|</span> <span class='q identifier id'>q</span><span class='dot token'>.</span><span class='hidden identifier id'>hidden</span><span class='rbrace token'>}</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>
    
    <div id="footer">
  Generated on Thu Dec  8 13:43:26 2011 by 
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.7.3 (ruby-1.8.7).
</div>

  </body>
</html>